package com.faiz.algorithm;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Hanoi {
    public static void solution(int topN, char from, char inter, char to) {
        if (topN == 1) {
            System.out.println("Disk 1 from "
                    + from + " to " + to);
        } else {
            solution(topN - 1, from, to, inter);
            System.out.println("Disk "
                    + topN + " from " + from + " to " + to);
            solution(topN - 1, inter, from, to);
        }
    }

//    public static int solutionFor4(int n, int k, List<Integer> list) {
//        if (1 == k) {
//            return 1;
//        } else {
//
//        }
//    }

    private static Map<Integer, Integer> map = new HashMap<>();

    //把递归变为数表的访问
    public static int M4(int n) {
        int tmp, m = 1 << 16;
        if (1 == n) {
            return 1;
        }
        for (int i = 1; i < n; i++) {
            tmp = 2 * M4(n - i) + (1 << i) - 1;
            if (tmp < m) {
                m = tmp;
            }
        }
        return m;
    }

    /**
     * 未完成
     * @param top 楼顶
     * @param bottom 楼底
     * @param k 鸡蛋个数
     * @return
     */
    public static int egg(int top, int bottom, int k) {
        if (top == bottom) {
            return top;
        } else {
            return 0;
        }
    }
}
